package vote.ai.job;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import vote.ai.factory.CorrectionFactory;


@Component
@Configuration
public class TextCorrectionJob {
    @Resource
    private CorrectionFactory correctionFactory;
    /**
     * todo 发布订阅处理任务解耦避免io空消耗
     * 每隔500毫秒执行一次文本纠错
     */
    @Scheduled(fixedRate = 5000)
    @Async("correctAsyncServiceExecutor")
    public void executeTextCorrection() {
        // 纠错
        this.correctionFactory.correctionTask();
    }
}
